home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 050 / tpstuff1.arc / FKCHK.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1984-12-30  |  896 b   |  27 lines

  1. program getFunctionKey;
  2. { A simple way to tell which function key has been pressed on an IBM PC or
  3.   other PC-DOS computer running Turbo Pascal.  }
  4. {$C-$U+}
  5. var
  6.    ch1,ch2  : char;
  7.    previous : boolean;
  8.    count    : integer;
  9.  
  10. begin
  11.    writeln('Hit 20 keys');
  12.    for count := 1 to 20 do
  13.    begin
  14.       read(kbd,ch1);         {read a character, if it is an ESC (chr(27) then}
  15.       if ch1 = chr(27) then  {the keystroke must be either an ESC key or one }
  16.       begin                  {that generates a two digit code                }
  17.          previous := true;
  18.          read(kbd,ch1);
  19.       end
  20.       else previous := false;
  21.       if previous then write('ESC ')
  22.       else write('single char ');
  23.       writeln('ord(ch1)= ',ord(ch1));
  24.    end;
  25.  
  26. end.
  27.